{% extends "base.html" %}


{% block announce %}
  <div id="version-banner">
  <script>

    // Show banner for people browsing the `main` docs that it is out of date
    if (window.location.pathname.match("^\/argocd-vault-plugin\/main\/.*") !== null) {
      const banner = document.createElement("h4");
      const msg = document.createTextNode("These docs are from the main branch and may reference unreleased features. ");
      const link = document.createElement("a");
      link.setAttribute("style", "color: white;text-decoration: underline;");
      link.setAttribute("href", `${window.location.origin}/argocd-vault-plugin/`)

      link.appendChild(document.createTextNode("Go here for the latest released docs"))
      banner.appendChild(msg);
      banner.appendChild(link);

      const currentDiv = document.getElementById("version-banner");
      currentDiv.appendChild(banner);
    }

    // Hide the banner entirely otherwise
    else {
      document.getElementsByClassName("md-announce")[0].setAttribute("style", "display: none;");
    }
  </script>
  </div>
{% endblock %}